Comments (3)
I cannot reproduce this problem. script --quiet
or script --quiet anyfile
works for me.
What version of the script do you have? And can you provide any example?
from util-linux.
I cannot reproduce this problem.
script --quiet
orscript --quiet anyfile
works for me.What version of the script do you have?
The version of script I was using is 2.39.3
.
And can you provide any example?
Since this ticket is about logging, you can try it it --log-in
or --log-out
. For example, script --quiet --log-out /path/to/file
. You'll notice that the "Script started on ..." message is always appended at the start of the log regardless of --quiet
. There's not really any special step in order to reproduce this, other than using the logging options and observing the log.
I've applied a patch locally which dealt with the problem. I no longer see the "Script started on ..." message appear in the logs after that. The basic idea is to wrap the logging in log_start
with an if
statement, like so:
diff --git a/term-utils/script.c b/term-utils/script.c
index 3457ac8..9cce9b4 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -391,30 +391,32 @@ static int log_start(struct script_control *ctl,
switch (log->format) {
case SCRIPT_FMT_RAW:
{
- int x = 0;
- char buf[FORMAT_TIMESTAMP_MAX];
- time_t tvec = script_time((time_t *)NULL);
+ if (!ctl->quiet) {
+ int x = 0;
+ char buf[FORMAT_TIMESTAMP_MAX];
+ time_t tvec = script_time((time_t *)NULL);
- strtime_iso(&tvec, ISO_TIMESTAMP, buf, sizeof(buf));
- fprintf(log->fp, _("Script started on %s ["), buf);
+ strtime_iso(&tvec, ISO_TIMESTAMP, buf, sizeof(buf));
+ fprintf(log->fp, _("Script started on %s ["), buf);
- if (ctl->command)
- x += fprintf(log->fp, "COMMAND=\"%s\"", ctl->command_norm);
+ if (ctl->command)
+ x += fprintf(log->fp, "COMMAND=\"%s\"", ctl->command_norm);
- if (ctl->isterm) {
- init_terminal_info(ctl);
+ if (ctl->isterm) {
+ init_terminal_info(ctl);
- if (ctl->ttytype)
- x += fprintf(log->fp, "%*sTERM=\"%s\"", !!x, "", ctl->ttytype);
- if (ctl->ttyname)
- x += fprintf(log->fp, "%*sTTY=\"%s\"", !!x, "", ctl->ttyname);
+ if (ctl->ttytype)
+ x += fprintf(log->fp, "%*sTERM=\"%s\"", !!x, "", ctl->ttytype);
+ if (ctl->ttyname)
+ x += fprintf(log->fp, "%*sTTY=\"%s\"", !!x, "", ctl->ttyname);
- x += fprintf(log->fp, "%*sCOLUMNS=\"%d\" LINES=\"%d\"", !!x, "",
- ctl->ttycols, ctl->ttylines);
- } else
- fprintf(log->fp, _("%*s<not executed on terminal>"), !!x, "");
+ x += fprintf(log->fp, "%*sCOLUMNS=\"%d\" LINES=\"%d\"", !!x, "",
+ ctl->ttycols, ctl->ttylines);
+ } else
+ fprintf(log->fp, _("%*s<not executed on terminal>"), !!x, "");
- fputs("]\n", log->fp);
+ fputs("]\n", log->fp);
+ }
break;
}
case SCRIPT_FMT_TIMING_SIMPLE:
I can submit a PR for the patch if it looks acceptable.
from util-linux.
But it's not expected that --quite
suppress anything in the log, man script:
-q, --quiet
Be quiet (do not write start and done messages to standard output).
from util-linux.
Related Issues (20)
- make sure lastlog2 is separated from original lastlog HOT 5
- `dmesg` gives different `--show-delta` values for the same message, depending on whether `--since` is used HOT 2
- New UUID formats HOT 5
- "libmount: don't canonicalize symlinks for bind operation" (1b2d818) caused problems with btrfs targets HOT 3
- Formatting mistake in `logger.1` HOT 1
- Manpages for vigr(8), swapoff(8) and lastb(1) don't link properly HOT 1
- whereis: Dereference symlinks
- `$ column -C hide` does not suppress the column... HOT 4
- lsns terminates with exit status 1 giving no error message.
- blkid_get_library_version(NULL,NULL) returns different values when using different build systems HOT 2
- blkdiscard all unpartitioned space HOT 5
- hexdump hang when reading format file with --format-file HOT 1
- Heap Buffer Overflow in Hexdump when processing format files
- Multiple memory corruption problems in dmesg
- Any interest in better supporting library consumers who use CMake with find_package HOT 8
- libtool: "has not been installed" warnings and related errors for multiple libraries HOT 1
- support env. variables to define output columns in ls-like tools
- "hexdump file" displays incorrect Windows text file line termination
- lsfd/mkfds-inotify test fails in debian build environment HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from util-linux.