-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SI-7634 resurrect the REPL's :sh command #3042
Conversation
You can test as ReplTest, with code ":sh ..." Get it? "shello, world."
and
|
Ah, I didn't know about those partest properties. The only missing piece was avoiding embedding an absolute path in the check file. It's updated.
That's neat. |
BTW, is |
The IDE failure is a miss, the build succeeded, but the job was marked as failed because there were no log files to be archived. |
Mr Phillips had complained that test/partest stopped working -- personally, I had always used ./partest -- and when I fixed that I presumably broke ./partest, but since no one complained, I didn't have the guts and grit to go back in and check it out. I'll make an effort, because it is an unnecessary annoyance. |
I forgot about the paths-in-check-file problem (due to past mental trauma on that issue). The absolute-path filter in partest's Runner will strip the test path prefix (but tokenized on space). There is also the If cwd is fixed, then the relative path in the checkfile will always be correct. I think Mr Phillips went to some lengths to absolutize paths everywhere in partest; but inside the test, this relative path is probably OK. (E.g., can you always relativize a path on a different device, say on Windows?) The tool script sets |
Hum, I am not entirely sure that cwd would be fixed even if partest was invoked from somewhere else. Although currently one can't do that anyway. But the I also reverted to |
LGTM Sorry to see the |
def java = propOrElse("javacmd", "java") | ||
def lib = propOrElse("partest.lib", "scala-library.jar") | ||
def sep = propOrElse("path.separator", ":") | ||
def jarg = s"-classpath $testOutput$sep$lib" |
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.
This looks like it will break if there is a space in the path. I know that's unlikely, but it does force us to discuss whether and how quoting/escaping is performed for the arguments to :sh
.
You could also simplify this a touch by not dependending on scala-library; just hand-roll your main
method and use System.out.println
.
Finally, we should have a test that shows what happens with :sh gobbledegook
. If that is too inconvenient to test in partest, perhaps because of an unstable stack trace, at least provide a transcript of a manual test.
I do sort of wonder whether this feature pays its weight, or whether we should just ask people to use scala.sys.process
.
ProcessResult had a companion object in 2.10 that somehow disappeared in 2.11. It only called "new ProcessResult(...)", so the REPL might just as well do that.
Sorry this lingered for so long, @gourlaysama! When addressing reviewer feedback, please ping the reviewer so the final LGTM can be given. |
SI-7634 resurrect the REPL's :sh command
To coin a phrase, "Wait, what?" This is OK w/me, but retronym, taxed as he must be, wondered if Somewhere on my todo is, Find interesting use cases for :sh. I bet paulp wishes he'd changed it to :awk. Really, anything with "shello, world" begs commitment. |
@adriaanm: oops, I meant to do that, sorry. Actually, I am wondering if fixing this regression was worth it considering what's below.
Actually, it is worse than that: With that in mind, @retronym convinced me that either:
If I can't get the latter to work, then I think |
I figured we can merge this PR now (as it's only one line and introduces a tests that seems reliable), and decide whether to remove |
ProcessResult had a companion object in 2.10 that somehow disappeared in
2.11. It only called "new ProcessResult(...)", so the REPL might just as
well do that.
This regression happened because
:sh
isn't tested; but then, I am not sure how to write a test for this that isn't platform-dependent.Review by @som-snytt