-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Bug] Needs Immediate Solution - Weird backslash handling #19
Comments
I have just made sure that when using in the script double backslash it is not escaped it is doubled, what I want to achieve is having |
Line parsing could be wrong for complex lines. To avoid weird escaping, you
can try to use the recently added `Shell.runExecutableArguments` to specify
explicitly the executable (osascript in your case) and the arguments one by
one.
…On Mon, Aug 10, 2020 at 1:55 PM Yazeed Al-Khalaf ***@***.***> wrote:
I have just made sure that when using in the script double backslash it is
not escaped it is doubled, what I want to achieve is having \" in the
final output of the script
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANEFVSUVH6TVIPKTPCKDTTR77N4NANCNFSM4PZ4AOFA>
.
|
Ah okay I will try it |
I have solved it by creating a bash file and putting the line of code inside it. |
@alextekartik isn't this a bug that should be resolved? I think this should be reopened since |
@therealsujitk As far as i know I agree, any parsing bug should be fixed on my side but I don't have any good example to test yet. If you have a similar bug and a command that fails, I would gladly take a look |
@alextekartik sure! here are some basic examples to reproduce this bug. I initially encountered this issue while attempting to write a much larger Example 1const command = r"echo '\ \\ \\\ \\\\ \\\\\ \\\\\\'";
print(command);
run(command); Output
Expected
Example 2const command = "echo '\\ \\\\ \\\\\\ \\\\\\\\ \\\\\\\\\\ \\\\\\\\\\\\'";
print(command);
run(command); Output
Expected
You're right! I'm not sure what I did before, but for some reason, it worked properly once. I can't remember what I did. That aside, the above examples are definitely a bug. Somewhere along the way, the script is being escaped unnecessarily. |
Thanks @therealsujitk I need to take a look again at why I did this (since the beginning) since this looks wrong to me now and would definitely not work in many cases. I'll look into it. |
Ok indeed that looked wrong and not posix compliant. I have a mixed feeling between a version fix and a breaking change so that is why I bumped the version to 0.14.0 (yes I know at some point I should make it 1.0.0...). |
Unfortunately that seems to break path parameters on windows so I might have a different behavior on Windows...
prints |
Posix backslash handling has now been removed on windows (I guess that explained why I did this global replace before). Published in v0.14.0+1 |
The problem is that when I try to run a script using
await shell.run(my_awesome_script)
.If there is a
\\
inmy_awesome_script
then it will take it as is, what I want is to escape it but it is not allowing me to do that. Specifically when I try to add a"
after it which is frustrating.Example:
Output:
The text was updated successfully, but these errors were encountered: