-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Error when running "detox test" for windows using detox 8 due to findstr not supporting /s in regex #886
Comments
Hmmm.... looks fair, though weird a bit - I'm almost sure I tested that, but maybe I forgot something. What Windows version, you say? |
Sorry for the missing information. I'm using windows 10. |
@dat00ste, no worries. 👍 I just did not want to enforce Windows users of Detox to install grep. Sad that I've submitted a pull request with a bugfix already. I hope that a hotfix version will appear in the next few days, maybe today if we are very lucky. P.S. And extra thanks for investigating the issue before submitting it. 🥇 |
Great, thanks! |
@dat00ste, it is a good question. I clearly remember it worked just fine on Windows... hmm. |
@dat00ste, right you are! apparently, it was looking for |
No problem, happy to help :). |
Description
When running detox test with detox 8 I get the following error:
detox[7016] INFO: [DetoxServer.js] server listening on localhost:56121...
detox[7016] ERROR: [exec.js/EXEC_FAIL, #1] "C:\Users\stina.emrikstrand\AppData\Local\Android\sdk\platform-tools\adb -s emulator-5554 shell dumpsys power | findstr /R /C:"^\sm[UW].="" failed with code = 1, stdout and stderr:
detox[7016] ERROR: [exec.js/EXEC_FAIL, #1]
detox[7016] ERROR: [exec.js/EXEC_FAIL, #1]
detox[7016] ERROR: [index.js/DETOX_INIT_ERROR]
{ ChildProcessError: Command failed: C:\Users\stina.emrikstrand\AppData\Local\Android\sdk\platform-tools\adb -s emulator-5554 shell dumpsys power | findstr /R /C:"^\sm[UW].="
C:\Users\stina.emrikstrand\AppData\Local\Android\sdk\platform-tools\adb -s emulator-5554 shell dumpsys power | findstr /R /C:"^\s*m[UW].*="
(exited with error code 1)at callback (C:\Users\stina.emrikstrand\code\App\powerup\node_modules\child-process-promise\lib\index.js:33:27)
at ChildProcess.exithandler (child_process.js:295:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
I have located the problem to that windows findstr does not support /s in regex. If I replace the line:
const stdout = await this.shell(deviceId,
dumpsys power | ${grep('^\\s*m[UW].*=')}
);with
const stdout = await this.shell(deviceId,
dumpsys power | ${grep('^ *m[UW].*=')}
);in detox/src/devices/android/ADB.js, it seems to work, for windows at least. I'm not sure about other OS, and since I'm not a developer I'm not sure this is the best way of solving it either :)
Detox, Node, Device, Xcode and macOS Versions
The text was updated successfully, but these errors were encountered: