Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Weird behavior of QProcess and multiple qoutes
Forum Updated to NodeBB v4.3 + New Features

Weird behavior of QProcess and multiple qoutes

Scheduled Pinned Locked Moved Solved General and Desktop
36 Posts 7 Posters 6.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Christian EhrlicherC Online
    Christian EhrlicherC Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #22

    Please run it on the command line. Maybe you don't have the proper privileges.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    G 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Please run it on the command line. Maybe you don't have the proper privileges.

      G Offline
      G Offline
      Guanhong
      wrote on last edited by
      #23

      @Christian-Ehrlicher
      I have run it on the command line, it is no problem.

      Christian EhrlicherC 1 Reply Last reply
      0
      • G Guanhong

        @Christian-Ehrlicher
        I have run it on the command line, it is no problem.

        Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #24

        @Guanhong Please show how you run it on the command line

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Guanhong
          wrote on last edited by
          #25

          @Guanhong said in Weird behavior of QProcess and multiple qoutes:

          <

          wpa_cli -i wlan0 set_network 1 ssid '"hima24g"'
          I run it on an Ubuntu console, and it can run successfully

          jsulmJ Christian EhrlicherC 2 Replies Last reply
          0
          • G Guanhong

            @Guanhong said in Weird behavior of QProcess and multiple qoutes:

            <

            wpa_cli -i wlan0 set_network 1 ssid '"hima24g"'
            I run it on an Ubuntu console, and it can run successfully

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #26

            @Guanhong said in Weird behavior of QProcess and multiple qoutes:

            wpa_cli -i wlan0 set_network 1 ssid '"hima24g"'

            wpa_cli -i wlan0 set_network 1 ssid hima24g
            

            should work just as good

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • G Guanhong

              @Guanhong said in Weird behavior of QProcess and multiple qoutes:

              <

              wpa_cli -i wlan0 set_network 1 ssid '"hima24g"'
              I run it on an Ubuntu console, and it can run successfully

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #27

              set_network 1

              is not

              "set_network" << "0"

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1
              • G Offline
                G Offline
                Guanhong
                wrote on last edited by
                #28

                wpa_cli -i wlan0 set_network 1 ssid hima24g
                without quotes, it does not work on my console.

                set_network 1 or set_network 0 does not matter.
                It depends.

                jsulmJ 1 Reply Last reply
                0
                • G Guanhong

                  wpa_cli -i wlan0 set_network 1 ssid hima24g
                  without quotes, it does not work on my console.

                  set_network 1 or set_network 0 does not matter.
                  It depends.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #29

                  @Guanhong So, did you try to print out https://doc.qt.io/qt-5/qprocess.html#readAllStandardError ?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #30

                    Looks like wpa_cli really needs additional double quotes... strange and weird program (see google for a lot of confusion due to this behavior).
                    So it must be

                    arguments << "-i" << "wlan0" << "set_network" << "0"<< "ssid" << "\"" + strSSID + "\"";
                    

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    G 1 Reply Last reply
                    2
                    • Christian EhrlicherC Christian Ehrlicher

                      Looks like wpa_cli really needs additional double quotes... strange and weird program (see google for a lot of confusion due to this behavior).
                      So it must be

                      arguments << "-i" << "wlan0" << "set_network" << "0"<< "ssid" << "\"" + strSSID + "\"";
                      
                      G Offline
                      G Offline
                      Guanhong
                      wrote on last edited by Guanhong
                      #31

                      @Christian-Ehrlicher
                      this command includes not only double quotes but also single quotes outside. Can QProcess handle it?

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Online
                        Christian EhrlicherC Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #32

                        The outer quotes are only needed so the inner ones are not removed by the shell.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        G 1 Reply Last reply
                        1
                        • Christian EhrlicherC Christian Ehrlicher

                          The outer quotes are only needed so the inner ones are not removed by the shell.

                          G Offline
                          G Offline
                          Guanhong
                          wrote on last edited by
                          #33

                          @Christian-Ehrlicher
                          I don't think so. both quotes are necessary, without either, the command doesn't work on command line.

                          JonBJ Christian EhrlicherC 2 Replies Last reply
                          0
                          • G Guanhong

                            @Christian-Ehrlicher
                            I don't think so. both quotes are necessary, without either, the command doesn't work on command line.

                            JonBJ Online
                            JonBJ Online
                            JonB
                            wrote on last edited by JonB
                            #34

                            @Guanhong
                            Do you understand that, certainly quote-wise, what you type into a shell/command-line is not the same as what you would put into the QStringList for the arguments to QProcess::start()?

                            Meanwhile if you helped us by using the forum's Code toolbutton around what you are entering on the command-line it would be a lot easier to read/understand.

                            1 Reply Last reply
                            0
                            • G Guanhong

                              @Christian-Ehrlicher
                              I don't think so. both quotes are necessary, without either, the command doesn't work on command line.

                              Christian EhrlicherC Online
                              Christian EhrlicherC Online
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on last edited by
                              #35

                              @Guanhong said in Weird behavior of QProcess and multiple qoutes:

                              I don't think so. both quotes are necessary, without either, the command doesn't work on command line.

                              I'm giving up.... don't know how often I must explain that your shell/command line removes the outer quotes...

                              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                              Visit the Qt Academy at https://academy.qt.io/catalog

                              G 1 Reply Last reply
                              3
                              • Christian EhrlicherC Christian Ehrlicher

                                @Guanhong said in Weird behavior of QProcess and multiple qoutes:

                                I don't think so. both quotes are necessary, without either, the command doesn't work on command line.

                                I'm giving up.... don't know how often I must explain that your shell/command line removes the outer quotes...

                                G Offline
                                G Offline
                                Guanhong
                                wrote on last edited by
                                #36

                                @Christian-Ehrlicher
                                thank you very much ,
                                arguments << "-i" << "wlan0" << "set_network" << "0"<< "ssid" << """ + strSSID + """;
                                works.

                                sorry for my poor understanding.

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved