M
M
Marat Nagayev2021-01-15 21:22:14
Python
Marat Nagayev, 2021-01-15 21:22:14

How to open nano programmatically?

Situation:
There is a console program. You need to implement the discovery of nano. My console program has a -c (config) option which should open the editor and when it closes my program should also close.
It doesn't matter what to implement. The original program is in Go, but if someone tells you how to do it in Python, it will also be nice (by analogy, I will do it in Go).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shurshur, 2021-01-15
@shurshur

For go suggested above (exec.Command)
For python - os.system.

A
askorn, 2021-01-22
@askorn

So:

package main

import (
  "log"
  "os/exec"
)

func main() {
  err := exec.Command("calc.exe", "-c").Run() // запуск и ожидание закрытия программы
  log.Println(err)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question