Closed richmonde closed 1 year ago
Cud's binary 'cudatext' (with .exe on Windows) is the single binary, so it cannot be run in background. SublimeText is not the same - is has additional binary 'subl' which opens 2nd binary of ST in background. i don't know how to change it in Cud.
maybe try to make the Bash script and put it to PATH.
(also consider to use Cud's plugin Terminal Plus
or ExTerminal
.)
So instant response! I am not familiar with Object Pascal but I just found lapce made it ,which is a code editor as well on github. Does Object Pascal has a solution to create a orphan process?
What is the orphan process? I don’t know it. Free pascal can run processes.
Orphan process is a process that its parent process finished but the child itself didn't exit. I just saw a Object Pascal fcl called process, you may have a try to see if it works to do that
my FPC code does run process - process “cp” to copy files on Linux installation (and another process - on MacOS)
but it don’t run any other processes IIRC.
my FPC code does run process - process “cp” to copy files on Linux installation (and another process - on MacOS)
but it don’t run any other processes IIRC.
"A process is a running program that serves as the foundation for all computation." Above is what I just copied from google searching "process in operating system". I mean CudaText may fork to create a independent one away from what launches it. I just found https://www.freepascal.org/docs-html/current/fcl/process/index.html
Sorry, I need that someone makes a patch . I am noob in “fork”.
Sorry, I need that someone makes a patch . I am noob in “fork”.
Haha, you are a great Object Pascal Programmer. This editor is great to use. I didn't have any experience of contributing to a open source project and Object Pascal programming. So just advice here, thank you!
@richmonde I workaround this "issue", but I don't really consider it a problematic issue.
If CudaText is already open, and @Alexey-T can explain process reuse, then running CudaText
from the command line will reuse the exiting CudaText
process.
However, the "issue" I think you are describing is when CudaText
is not already running.
I work around this with a shell script in my path called run
.
#!/bin/sh
# ~/bin/run
setsid 1> /dev/null 2> /dev/null $@ &
I have an alias (or script) for CudaText
called edit
If the latter a, script, it something like:
#!/bin/sh
run /path/to/CudaText [other arguments as needed, especially if a flatpak] $@
So the first time, if CudaText
is not already running, a new CudaText
is launched, but the process is detached from the current terminal through the setsid
and &
in the run script.
Subsequent uses a temporary process is started, but CudaText
sees the existing process and passes the files to open off to it (or something like that, @Alexey-T can explain). That temporary process exits.
So for me, both for initial and subsequent uses from the command line the process invocation is transparent to me.
Hmm... If I don't use my edit wrapper (which hides stdout and stderr) while it works for subsequent edits, I do get this without the wrapper (even though I get the prompt back as the original process is being used).
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$0000000000430111
$000000000052B9C1
$000000000052B967
$000000000052C73B
$0000000000435BAB
$000000000043A437
Exception at 0000000000430111: EAccessViolation:
Access violation.
I guess I need to file that... (but it is low priority for me, as my edit wrapper is working...)
Cud's binary 'cudatext' (with .exe on Windows) is the single binary, so it cannot be run in background. SublimeText is not the same - is has additional binary 'subl' which opens 2nd binary of ST in background. i don't know how to change it in Cud.
That is the preferred way of doing it. To make CudaText work like my wrapper scripts (but without the wrapper scripts).
(when existing Cud process is running, next process talks to it via IPC code, which is standard code in FreePascal... i don't know details..)
If I understand correctly, you want to keep the shell staying interactive after launch CudaText via command.
The problem varies between shells. If you launch it on Windows via native shells like CMD or PowerShell, it will not block the terminal window (as you expected). The problem will (probably) arise when you use SH-family. On sh-family, there is one quick and simple solution. That is to put '&' char at the end of the command to tell the shell to gain control after command execution.
cudatext abc.txt &
@ThaiDat 's advice is correct (i knew it but forgot).
Hi Contributors, I am impressed by CudaText's great functionality so I wanna make it my main code editor. However as I often use terminal to work, I found that terminal blocked and printed logs after I type
cudatext filename
to open files. And it's not a fundamental workaround to open new windows of terminal since I may not open multiple files at once. So I hope the feature said in the issue's title would be implemented in future release. Thanks to all contributors.