Closed mattmassicotte closed 1 year ago
One thing working mentioning here is the Glob package currently being used does need to be replaced. I already have a package that should be usable, but it's a little work to get it integrated.
Additionally this package imports os.log. That could switch to https://github.com/apple/swift-log maybe?
https://github.com/ChimeHQ/LanguageClient/blob/main/Sources/LanguageClient/LocalProcessServer.swift#L5 could be os(macOS) || os(Linux)
ProcessEnvTests.testEnvironmentVariables seems not to work (The bash stays around => Test never ends)
FSEventsWrapper is basically a wrapper around a MacOS only API
Fixing the logging shouldn't be difficult. I have no experience with swift-log, but I'm not opposed. I'll start by using some conditional compilation to just remove it.
Conditionalizing the FSEventsWrapper dependency should be straightforward. I thought I did that for iOS too...
I'm not sure what could be up with with ProcessEnv, but it is starting up processes and that's always fraught.
I'm not sure what could be up with with ProcessEnv, but it is starting up processes and that's always fraught.
It starts using /bin/bash -ilc /usr/bin/env to get the environment variables. But then it hangs. The status is "Stopped" due to the signal SIGTTIN with this backtrace:
#0 0x00007fd13ad01d5b in kill () at ../sysdeps/unix/syscall-template.S:120
#1 0x000056445e46d083 in initialize_job_control (force=<optimized out>) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/jobs.c:4433
#2 0x000056445e43bb47 in shell_initialize () at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/shell.c:1994
#3 0x000056445e438fa9 in main (argc=argc@entry=3, argv=argv@entry=0x7ffe9d25b1d8, env=0x7ffe9d25b1f8) at /usr/src/debug/bash-5.2.15-1.fc37.x86_64/shell.c:590
#4 0x00007fd13acec510 in __libc_start_call_main (main=main@entry=0x56445e438460 <main>, argc=argc@entry=3, argv=argv@entry=0x7ffe9d25b1d8) at ../sysdeps/nptl/libc_start_call_main.h:58
#5 0x00007fd13acec5c9 in __libc_start_main_impl (main=0x56445e438460 <main>, argc=3, argv=0x7ffe9d25b1d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe9d25b1c8) at ../csu/libc-start.c:381
#6 0x000056445e439ef5 in _start ()
Removing the -i fixes this, but as in the comments it was noted -i is critical, it would break things AFAIK
Hmmm. That's interesting. Does /bin/bash -ilc /usr/bin/env
terminate on its own when run in your linux shell? Maybe there's another flag that needs to be passed in? Or, maybe Process
in the Linux Foundation is the issue.
Also, I pushed up a change that conditionalizes os.log
, and adds a very long overdue test. It's barebones, but paves the way for running CI against Linux too.
Hmmm. That's interesting. Does
/bin/bash -ilc /usr/bin/env
terminate on its own when run in your linux shell? Maybe there's another flag that needs to be passed in? Or, maybeProcess
in the Linux Foundation is the issue.
Yes it does worl there. I'm not on my laptop this weelned, but I would test using raw exec* syscalls to avoid potential bugs in the layers of Foundation. If it still doesn't worl, the args have to be adjusted
I've been involved with some pretty major changes to better support Swift concurrency. As part of that work, I've been paying more attention to Linux support. I'm adding CI for it as well - though Swift 5.9 currently isn't available in the GitHub runner image unfortunately.
But, my hope this this will help keep things working much better going forward.
This is now in place! I'll be keeping linux supported going forward. If anything new pops up, please open up a new issue.
Thanks a lot!
Coming from discussion started with https://github.com/ChimeHQ/JSONRPC/pull/5, it would be great to offer linux compatibility.