(reader io.Reader)
| 1409 | } |
| 1410 | |
| 1411 | func readOptionalCommandInput(reader io.Reader) (string, error) { |
| 1412 | if reader == nil { |
| 1413 | return "", nil |
| 1414 | } |
| 1415 | if file, ok := reader.(*os.File); ok { |
| 1416 | info, err := file.Stat() |
| 1417 | if err != nil { |
| 1418 | return "", fmt.Errorf("cli: stat stdin: %w", err) |
| 1419 | } |
| 1420 | if info.Mode()&os.ModeCharDevice != 0 { |
| 1421 | return "", nil |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | data, err := io.ReadAll(reader) |
| 1426 | if err != nil { |
| 1427 | return "", fmt.Errorf("cli: read stdin: %w", err) |
| 1428 | } |
| 1429 | return string(data), nil |
| 1430 | } |
| 1431 | |
| 1432 | func parseMemoryPromotionSelector( |
| 1433 | deps commandDeps, |
no outgoing calls