[runcommand] Add windows support
ClosedPublic

Authored by jambon on Nov 7 2018, 9:33 PM.

Details

Summary

Added windows support to the runcommand plugin
Completes T10001

Test Plan
  1. Run a command
  2. Run the command

Diff Detail

Repository
R224 KDE Connect
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jambon created this revision.Nov 7 2018, 9:33 PM
Restricted Application added a subscriber: kdeconnect. · View Herald TranscriptNov 7 2018, 9:33 PM
jambon requested review of this revision.Nov 7 2018, 9:33 PM
jambon edited the summary of this revision. (Show Details)Nov 7 2018, 10:46 PM
nicolasfella requested changes to this revision.Nov 8 2018, 2:25 AM
nicolasfella added a subscriber: nicolasfella.

Thanks for the patch!

I didn't test on Windows, but this breaks runcommand on Linux. ARGS on Linux needs to be "-c"

This revision now requires changes to proceed.Nov 8 2018, 2:25 AM
apol added a subscriber: apol.Nov 8 2018, 12:04 PM

Thanks for the patch!

I didn't test on Windows, but this breaks runcommand on Linux. ARGS on Linux needs to be "-c"

looks like -c and /c are swapped ;)

You should explicitly tell the user somewhere on the interface that cmd is being used to run the commands, since windows has many shells with entirely different syntax.
Maybe we can provide an option to select the shell. Basically an input box to fill the value of COMMAND and ARGS variable in the above code.

jambon updated this revision to Diff 45116.Nov 8 2018, 1:07 PM

Sorry, I accidentally swapped -c and /c.
@shivanshukantprasad If the user wants to run commands on other shells. They could just invoke the shells themselves.

albertvaka accepted this revision.Nov 8 2018, 1:40 PM
albertvaka added a subscriber: albertvaka.

Would powershell be a better default, though? I don't think you can do much with cmd, actually.

jambon added a comment.Nov 8 2018, 1:49 PM

Powershell is slow to start, especially on older computers. So if people just want to run a simple command, it'll create unessasary delay. If people really want to run powershell, they could just put powershell -c <command> in their command

This revision was not accepted when it landed; it landed in state Needs Review.Nov 8 2018, 1:55 PM
This revision was automatically updated to reflect the committed changes.

Merged, but arcanist (the command line tool for Phabricator) gave me some problems because it looks like you cloned the repo from Github. It will work better if you clone it from https://anongit.kde.org/kdeconnect-kde.git

Also, in case you are not using arcanist to upload the patches, I recommend you to use it: https://community.kde.org/Infrastructure/Phabricator#Using_Arcanist_to_post_patches

@jambon I agree that the user can just invoke other shells but the user would probably find it easier to use if he knows what the default is, displaying it somewhere in the user interface would probably make it easier to use.