1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

nix copy: Revive progress bar

This commit is contained in:
Eelco Dolstra 2017-08-14 15:28:16 +02:00
parent dffc3fe43b
commit c5e4404580
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 99 additions and 2 deletions

View file

@ -56,6 +56,8 @@ static void dumpContents(const Path & path, size_t size,
static void dump(const Path & path, Sink & sink, PathFilter & filter)
{
checkInterrupt();
struct stat st;
if (lstat(path.c_str(), &st))
throw SysError(format("getting attributes of path '%1%'") % path);

View file

@ -80,4 +80,15 @@ std::atomic<uint64_t> nextId{(uint64_t) getpid() << 32};
Activity::Activity() : id(nextId++) { };
Activity::Activity(ActivityType type, std::string msg)
: Activity()
{
logger->event(evStartActivity, id, msg);
}
Activity::~Activity()
{
logger->event(evStopActivity, id);
}
}

View file

@ -13,6 +13,10 @@ typedef enum {
lvlVomit
} Verbosity;
typedef enum {
actCopyPath = 100,
} ActivityType;
class Activity
{
public:
@ -21,6 +25,10 @@ public:
Activity();
Activity(const Activity & act) : id(act.id) { };
Activity(uint64_t id) : id(id) { };
Activity(ActivityType type, std::string msg = "");
~Activity();
//void progress(...);
};
typedef enum {
@ -35,6 +43,13 @@ typedef enum {
evSubstitutionCreated = 8,
evSubstitutionStarted = 9,
evSubstitutionFinished = 10,
evCopyStarted = 100,
evCopyProgress = 101,
evStartActivity = 1000,
evStopActivity = 1001,
} EventType;
struct Event