On 8/26/21 5:15 AM, Stef Walter wrote:


On Wed, Aug 25, 2021 at 8:51 PM Mark Reynolds <[email protected] <mailto:[email protected]>> wrote:

    Well I tried a lot of different things, but for some reason switching
    the first two items to use single quotes instead of double quotes
    got it
    working:

                                                  let cmd = [
    -                                                "/bin/sh",
    -                                                "-c",
    +                                                '/bin/sh', '-c',
    '/usr/bin/echo -e "' +
    setup_inf + '" >> ' + setup_file
                                                  ];


That's strange. Not sure what would cause such a regression. Perhaps a different javascript compiler/transpiler?

In any case, you may be looking for cockpit.script():
Actually below I stated I had tried script() as well, but it was also behaving the same way.  Very odd...

https://cockpit-project.org/guide/latest/cockpit-spawn#cockpit-spawn-script <https://cockpit-project.org/guide/latest/cockpit-spawn#cockpit-spawn-script>

Cheers,

Stef

On 8/25/21 12:38 PM, Mark Reynolds wrote:
> This code used to work for a long time, but now it stopped working as
> expected:
>
>     let cmd = [
>         "/bin/sh",
>         "-c",
>         '/usr/bin/echo TEST >> ' + setup_file
>     ];
>
>     cockpit.spawn (cmd, { superuser: true, err: "message" })
>
>
> Now the output file (setup_file) is empty.
>
> When I run that command on F33 it also does not write to the file.
> Ok, so I changed it to just "echo STRING >> /tmp/my_file" which works
> on the command line, but in Cockpit spawn it still does not write/echo
> to the file:
>
>     let cmd = [
>         '/usr/bin/echo TEST >> ' + setup_file
>     ];
>
>     cockpit.spawn (cmd, { superuser: true, err: "message" })
>
>
> I've tried different variations of this command, but none of them
> actually write (or echo) to the file whne using spawn().  I also tried
> "script(), but it didn't help.  This used to work until just recently,
> so I'm not sure what is wrong or what changed in Cockpit/Fedora...
>
> Any suggestions would be great.
>
> Thanks,
>
> Mark
>
>
--
Directory Server Development Team
_______________________________________________
cockpit-devel mailing list -- [email protected] <mailto:[email protected]> To unsubscribe send an email to [email protected] <mailto:[email protected]> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ <https://docs.fedoraproject.org/en-US/project/code-of-conduct/> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines <https://fedoraproject.org/wiki/Mailing_list_guidelines> List Archives: https://lists.fedorahosted.org/archives/list/[email protected] <https://lists.fedorahosted.org/archives/list/[email protected]> Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure <https://pagure.io/fedora-infrastructure>


--
Stef Walter (he / his)
Linux Engineering
Red Hat

_______________________________________________
cockpit-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

--
Directory Server Development Team

_______________________________________________
cockpit-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to