sapling icon indicating copy to clipboard operation
sapling copied to clipboard

q: How to distinguish Sapling from πŸš‚ Steam Locomotive?

Open vegerot opened this issue 2 years ago β€’ 13 comments

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 --version shows "Sapling ..."~~ πŸš‚ --version just 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 .sl directory before invoking sl. 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.

🀑

vegerot avatar Apr 07 '23 20:04 vegerot

related: https://github.com/facebook/jest/issues/14046, https://github.com/facebook/jest/pull/14061

vegerot avatar Apr 07 '23 20:04 vegerot

I don't see anything in the πŸš‚ source code which would let us easily detect it. =\

strager avatar Apr 07 '23 20:04 strager

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.)

strager avatar Apr 07 '23 20:04 strager

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

vegerot avatar Apr 07 '23 20:04 vegerot

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.

strager avatar Apr 07 '23 20:04 strager

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. πŸ˜…

dvanoni avatar Apr 08 '23 17:04 dvanoni

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

SimenB avatar Apr 08 '23 17:04 SimenB

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 πŸ˜€

SimenB avatar Apr 08 '23 17:04 SimenB

Good point. @sTRAGER how did you mean "improve Jest's error reporting"?

vegerot avatar Apr 10 '23 19:04 vegerot

@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)

vegerot avatar May 10 '23 23:05 vegerot