Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

401
Visualizações
How can I run a Python script or Terminal Command in JS web app?

I am looking for running a function in JS when a button is clicked in the interface, I expect that it should execute terminal commands, this is the job of the function.

The first thing which came into my mind is that to use the OS module in Python so that I can use os.system() to run terminal commands, I found some videos on YouTube but most of them do guide you how to do it but not from client-side.

It would be really appreciated if you can explain me what's client-side, because I asked for help on Discord but people keep talking about it, I just need a simple understandable explanation/summary/conclusion

So, when I found no resource to run a Python script from JS, I though about running the terminal commands directly from JS, but still didn't found any resource which can help

So, you would like to understand more? Here is my case:

I am making a web app which is a code obfuscator, and to obfuscate code I want to use terminal commands, those commands work without problems, so I want to run those commands from JS.

The app will be hosted on a Linux Server (Linode) provided by Linode, it's Ubuntu LTS

Note: This project is a web app, HTML/CSS/JS and extra

Thanks for your help! Feel free if you have any doubts ask me in the commments

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Regarding your first question.

Client-side (rendering) refers to everything in a web application that is displayed or takes place on the client (end-user device). This includes what the user sees, such as text, images, and the rest of the UI, along with any actions an application performs within the user's browser.

Because of these reasons and since you can't run anything else but HTML, CSS, and pure JavaScript on the client-side, you can also understand why you can not execute bash commands on the client-side; for that, you'll have to create a server-side application that will catch the request from the client-side, execute/complete the request, and return the result to the client.

There is a nice article about client-side working with the back-end which you can read here https://dev.to/gbudjeakp/how-to-connect-your-client-side-to-your-server-side-using-node-and-express-2i71

From there and once you'll have the server-side client running you'll be able to use packages like "child_process" which will help you execute bash commands for example and a lot more

Simple example running ls using child_process

const { exec } = require("child_process");

exec("ls -la", (err, stdout, stderr) => {
    if (err) {
        console.log(`error: ${err.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }
    console.log(`stdout: ${stdout}`);
});
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda