-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add windowsVerbatimArguments to not add '
in the argument for Windows environment
#753
Conversation
lib/server-builder.js
Outdated
@@ -74,7 +74,7 @@ class ServerBuilder { | |||
|
|||
getCommand () { | |||
const cmd = system.isWindows() ? 'gradlew.bat' : './gradlew'; | |||
const buildProperty = (key, value) => value ? `-P${key}=${value}` : null; | |||
const buildProperty = (key, value) => value ? `-P${key}="${value}"` : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather check explicitly if the corresponding value already contains quotes and throw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the root cause was -PappiumTargetPackage="io.appium.android.apis"
etc was wrapped by '
in the command. So, with "
, the command will be like:
[Espresso] Unable to build Espresso server - Process ended with exitcode 1 (cmd: './gradlew '-PappiumTargetPackage="io.appium.android.apis"' app\:assembleAndroidTest')
But expected one should be ./gradlew -PappiumTargetPackage="io.appium.android.apis" app\:assembleAndroidTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, i figured out.
The command will be ./gradlew '-PappiumKeyPassword=START&END'
.
Then, macOS and Linux have no issue. They handle "START&END" as a string.
But on Windows, ./gradlew '-PappiumKeyPassword=START&END'
will be ./gradlew -PappiumKeyPassword=START
and END
in the command prompt. in the case, the argument should be ./gradlew -PappiumKeyPassword="START&END"
. In powershell, it should be ./gradlew -PappiumKeyPassword="START\&END"
(escape)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KazuCocoa The gradle documentation says
Options that accept values can be specified with or without = between the option and argument; however, use of = is recommended.
So we could maybe try to make the value to a separate arg instead of quoting the whole expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I tried like the below command, but then, the separated arg was handled as a task.
% ./gradlew -PappiumKeyPassword "START&END" app:assembleAndroidTest
FAILURE: Build failed with an exception.
* What went wrong:
Task 'START&END' not found in root project 'espresso-server'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
I've combined args as a command like:
const gradlebuild = new SubProcess(cmd + ' ' + args.join(' '),[], {
cwd: this.serverPath,
stdio: ['ignore', 'pipe', 'pipe'],
});
, then, the generated command was ./gradlew -PappiumTargetPackage="io.appium.android.apis" app:assembleAndroidTest ENOENT
. So the ENOENT
prevent the command. Maybe i need to see SubProcess
ok... so, for now, this PR can focus on wrapping arguments with |
@@ -163,6 +163,7 @@ class ServerBuilder { | |||
const gradlebuild = new SubProcess(cmd, args, { | |||
cwd: this.serverPath, | |||
stdio: ['ignore', 'pipe', 'pipe'], | |||
windowsVerbatimArguments: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#752 (comment)
Ok, so, with this one, at least '
in Windows env will gone. Then, they can provide "xxxx"
as the capability to avoid
the Windows's escape error....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, with this PR and "START&END"
as the capability, the
END is not recognized as an internal or external command,
error should fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add "
automatically on Windows case after this merge and ask the reporter to try out this (if needed)
This reverts commit b4b04e0.
'
in the argument for Windows environment
## [2.1.1](v2.1.0...v2.1.1) (2022-02-27) ### Bug Fixes * add windowsVerbatimArguments to not add `'` in the argument for Windows environment ([#753](#753)) ([69f344c](69f344c))
🎉 This PR is included in version 2.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #752