Skip to content

os/exec: the windows route command run failed with wrong output. #13995

@iswarezwp

Description

@iswarezwp

The code:

package main

import (
    "fmt"
    "os/exec"
)

func main() {
    cmd := exec.Command("route", "ADD", "10.20.30.40", "MASK 255.255.255.255",
        "192.168.12.14")

    ret, err := cmd.CombinedOutput()
    if err != nil {
        fmt.Println(string(ret))
    }
}

I run this code under nomal and administrator model, and get the same result:

route:             192.168.12.14

Then I write some Python code:

import os

print(os.popen("route ADD 10.20.30.40 MASK 255.255.255.255 192.168.12.13").readlines()[0])

I got different result with different console model. And the output is just the same as I run the command directly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions