Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
This commit is contained in:
parent
7b632f9ccb
commit
78a99587a4
36 changed files with 184 additions and 229 deletions
|
|
@ -75,7 +75,7 @@ const poDemon* {.deprecated.} = poDaemon ## Nim versions before 0.20
|
|||
proc execProcess*(command: string, workingDir: string = "",
|
||||
args: openArray[string] = [], env: StringTableRef = nil,
|
||||
options: set[ProcessOption] = {poStdErrToStdOut, poUsePath, poEvalCommand}):
|
||||
TaintedString {.rtl, extern: "nosp$1",
|
||||
string {.rtl, extern: "nosp$1",
|
||||
tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
|
||||
## A convenience procedure that executes ``command`` with ``startProcess``
|
||||
## and returns its output as a string.
|
||||
|
|
@ -504,13 +504,13 @@ when not defined(useNimRtl):
|
|||
args: openArray[string] = [], env: StringTableRef = nil,
|
||||
options: set[ProcessOption] = {poStdErrToStdOut, poUsePath,
|
||||
poEvalCommand}):
|
||||
TaintedString =
|
||||
string =
|
||||
|
||||
var p = startProcess(command, workingDir = workingDir, args = args,
|
||||
env = env, options = options)
|
||||
var outp = outputStream(p)
|
||||
result = TaintedString""
|
||||
var line = newStringOfCap(120).TaintedString
|
||||
result = ""
|
||||
var line = newStringOfCap(120)
|
||||
while true:
|
||||
# FIXME: converts CR-LF to LF.
|
||||
if outp.readLine(line):
|
||||
|
|
@ -1572,7 +1572,7 @@ elif not defined(useNimRtl):
|
|||
proc execCmdEx*(command: string, options: set[ProcessOption] = {
|
||||
poStdErrToStdOut, poUsePath}, env: StringTableRef = nil,
|
||||
workingDir = "", input = ""): tuple[
|
||||
output: TaintedString,
|
||||
output: string,
|
||||
exitCode: int] {.tags:
|
||||
[ExecIOEffect, ReadIOEffect, RootEffect], gcsafe.} =
|
||||
## A convenience proc that runs the `command`, and returns its `output` and
|
||||
|
|
@ -1619,8 +1619,8 @@ proc execCmdEx*(command: string, options: set[ProcessOption] = {
|
|||
inputStream(p).write(input)
|
||||
close inputStream(p)
|
||||
|
||||
result = (TaintedString"", -1)
|
||||
var line = newStringOfCap(120).TaintedString
|
||||
result = ("", -1)
|
||||
var line = newStringOfCap(120)
|
||||
while true:
|
||||
if outp.readLine(line):
|
||||
result[0].string.add(line.string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue