Hello Digital Man,
What would the *correct* way be to run nano from a javascript?
I've tried..
system.exec("/usr/bin/nano");
bbs.exec("/usr/bin/nano",mode=EX_NATIVE);
..and neither of them seem to work. Synchronet runs as root so permissions are not an issue.
system.exec("/usr/bin/nano");
bbs.exec("/usr/bin/nano",mode=EX_NATIVE);
..and neither of them seem to work. Synchronet runs as root so
permissions are not an issue.
Both of these will execute "/usr/bin/nano". But if you want the input/output to be intercepted and sent to the remote user, you'll
need use either bbs.exec() with the EX_INR and EX_OUTR flags set (for input and output redirection), like
so:
bbs.exec("/usr/bin/nano", EX_NATIVE|EX_INR|EX_OUTR);
But the best way to run an external editor is to configure it as an external editor (in SCFG) and run it from JS with console.editfile(filename);
Hello Digital,
On 03 Mar 16 18:21, Digital Man wrote to Accession:
system.exec("/usr/bin/nano");
bbs.exec("/usr/bin/nano",mode=EX_NATIVE);
..and neither of them seem to work. Synchronet runs as root so
permissions are not an issue.
Both of these will execute "/usr/bin/nano". But if you want the input/output to be intercepted and sent to the remote user, you'll
need use either bbs.exec() with the EX_INR and EX_OUTR flags set (for input and output redirection), like
so:
bbs.exec("/usr/bin/nano", EX_NATIVE|EX_INR|EX_OUTR);
This worked! And oddly enough worked awesome at that!
But the best way to run an external editor is to configure it as an external editor (in SCFG) and run it from JS with console.editfile(filename);
Not sure I understand what you mean here. By "run it from JS" you mean nano?
I suppose I should explain what is going on. I asked Nightfox if he could rip out the function in SlyEdit that reformats MSGTMP with quoted initials, so I could offer up nano as a message editor as well (and possibly even vim in the future), since they can be used in "restricted" mode where nothing on the disk can be altered except the file loaded, ie: MSGTMP.
So after all of that is done, and a new formatted MSGTMP is created, the JS runs nano, where you can edit and save, and then the JS posts the message and exits back to the BBS.
So if there's a better way than the first option above you gave, by all means explain it to me in laman's terms and I'll give that a shot as well.
Not sure I understand what you mean here. By "run it from JS" you mean
nano?
The editor. The console.editfile() method uses whatever editor the user has selected as their preferred editor to edit the filename passed.
I suppose I should explain what is going on. I asked Nightfox if he
could rip out the function in SlyEdit that reformats MSGTMP with
quoted initials, so I could offer up nano as a message editor as well
(and possibly even vim in the future), since they can be used in
"restricted" mode where nothing on the disk can be altered except the
file loaded, ie: MSGTMP.
So after all of that is done, and a new formatted MSGTMP is created,
the JS runs nano, where you can edit and save, and then the JS posts
the message and exits back to the BBS.
So if there's a better way than the first option above you gave, by
all means explain it to me in laman's terms and I'll give that a shot
as well.
It sounds like you want to use SlyEdit as a quoter, but not an editor?
There's really no built-in method in Synchronet to do that (support external "quoters"). If you just want to use nano as an editor and don't need anything from SlyEdit, the proper way would be to configure nano in SCFG->External Programs->External Editors.
The editor. The console.editfile() method uses whatever editor the
user has selected as their preferred editor to edit the filename
passed.
Even when nano itself is not configured in External Editors? I don't see how the JS could know that the user is actually selecting nano as their editor.
Even when nano itself is not configured in External Editors? I
don't see how the JS could know that the user is actually
selecting nano as their editor.
For console.editfile(), the editor would need to be configured in
External Editors. So to do that with Nano, Nano would need to be set
up in External Editors and the user would have had to select it as
their editor. console.editfile() is simply a function that tells Synchronet to let the user edit a file with whatever editor they've chosen.
Hello Digital Man,
Not sure I understand what you mean here. By "run it from JS" you mean
nano?
The editor. The console.editfile() method uses whatever editor the user has selected as their preferred editor to edit the filename passed.
Even when nano itself is not configured in External Editors? I don't see how the JS could know that the user is actually selecting nano as their editor. See below..
Sysop: | Ree |
---|---|
Location: | Toronto, ON |
Users: | 2 |
Nodes: | 10 (0 / 10) |
Uptime: | 140:25:04 |
Calls: | 369 |
Files: | 2 |
Messages: | 38,441 |