q: How to distinguish Sapling from π Steam Locomotive?
I know what you're thinking.
Wasn't April Fools a week ago?
I can assure you this Issue is no jest. We are having a problem with some tools that support Sapling where they don't work properly on systems with Steam Locomotive π (also called sl).
My question is: how can we distinguish between systems that have Sapling installed or π ?
ideas:
- ~~
sl --versionshows "Sapling ..."~~π --versionjust shows the π - ~~check
man sl~~ inconsistent, not portable with Windows - ~~set a timeout on commands invoking sl~~ slow
- walk up the directory tree and look for
.sldirectory before invokingsl. Maybe, but this is slow - check binary sizes. Sapling is 50Mb and π is 34k. We can simply check if
sl> 1Mb
I like the last solution best, but would need to resolve symlinks, etc.
π€‘
related: https://github.com/facebook/jest/issues/14046, https://github.com/facebook/jest/pull/14061
I don't see anything in the π source code which would let us easily detect it. =\
Maybe Sapling could distribute two executables: sl and sapling. The latter could be used by scripts or at least feature detection. (sapling could just be a symbolic link to sl, or vice versa.)
worst idea: the whole point of installing π is to troll yourself. If you have decided to subject yourself to it, then you deserve whatβs coming for you.
The main downside is that in Jest it doesnβt randomly turn your whole screen into a π, it just hangs and prints a weird error message. imo if Jest took over your terminal with a π animation I would be okay with that, because you installed π and itβs your fault. However, if someone installed π two years ago and forgot about it, itβs going to be really hard for them to figure out why their test runner is broken
if someone installed π two years ago and forgot about it, itβs going to be really hard for them to figure out why their test runner is broken
It sounds like Jest's error reporting needs to be improved.
if someone installed π two years ago and forgot about it, itβs going to be really hard for them to figure out why their test runner is broken
I can confirm that it was indeed very hard for me to figure out what was going on. I lost hours to this. π
FWIW, I think it's a good idea to distribute a "full" name version. Like yarn is both yarn and yarnpkg. But that doesn't really solve the underlying issue
if someone installed π two years ago and forgot about it, itβs going to be really hard for them to figure out why their test runner is broken
It sounds like Jest's error reporting needs to be improved.
How so? AFAICT, if we cannot detect if sl is sapling or not, there's no proper solution I see to this that doesn't involve guessing, crossed fingers, random timeouts and/or a combination of them. I'd love to be proven wrong, tho π
Good point. @sTRAGER how did you mean "improve Jest's error reporting"?
@sTRAGER's idea to also ship a sapling binary will help for Windows too, since we could just distribute sapling since sl is a built-in Powershell alias for Set-Location (i.e. cd)