ronantakizawa/codereview-bench huggingface dataset:
Repository: microsoft/vscode
File: src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts (TypeScript)

Code before:
	private _handleCommandExecuted() {
		if (this._state === PromptInputState.Execute) {
			return;
		}

		this._cursorIndex = -1;

		// Remove any ghost text from the input if it exists on execute
		if (this._ghostTextIndex !== -1) {
			this._value = this._value.substring(0, this._ghostTextIndex);
			this._ghostTextIndex = -1;
		}

		const event = this._createStateObject();
		if (this._lastUserInput === '\u0003') {
			this._lastUserInput = '';
			this._onDidInterrupt.fire(event);
		}

		this._state = PromptInputState.Execute;
		this._onDidFinishInput.fire(event);
		this._onDidChangeInput.fire(event);
	}

	private _handleCommandFinished() {
		// Clear the prompt input value when command finishes to prepare for the next command
		// This prevents runCommand from detecting leftover text and sending ^C unnecessarily
		this._value = '';
	}

	@throttle(0)
	private _sync() {
		try {
			this._doSync();
		} catch (e) {
			this._logService.error('Error while syncing prompt input model', e);
		}
	}

	private _doSync() {
		if (this._state !== PromptInputState.Input) {
			return;
		}

		let commandStartY = this._commandStartMarker?.line;
		if (commandStartY === undefined) {
			return;
		}

		const buffer = this._xterm.buffer.active;
		let line = buffer.getLine(commandStartY);

Review comment (suggestion):
Should there also be `Finish` state that we can benefit from setting here?

There are only unknown, input, and execute: https://github.com/microsoft/vscode/blob/e76e5a9069234704791fc428e7eacbdc040764f0/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts#L14-L18 

Code after:
	private _handleCommandExecuted() {
		if (this._state === PromptInputState.Execute) {
			return;
		}

		this._cursorIndex = -1;

		// Remove any ghost text from the input if it exists on execute
		if (this._ghostTextIndex !== -1) {
			this._value = this._value.substring(0, this._ghostTextIndex);
			this._ghostTextIndex = -1;
		}

		const event = this._createStateObject();
		if (this._lastUserInput === '\u0003') {
			this._lastUserInput = '';
			this._onDidInterrupt.fire(event);
		}

		this._state = PromptInputState.Execute;
		this._onDidFinishInput.fire(event);
		this._onDidChangeInput.fire(event);
	}

	private _handleCommandFinished() {
		// Clear the prompt input value when command finishes to prepare for the next command
		// This prevents runCommand from detecting leftover text and sending ^C unnecessarily
		this._value = '';
		this._onDidChangeInput.fire(this._createStateObject());
	}

	@throttle(0)
	private _sync() {
		try {
			this._doSync();
		} catch (e) {
			this._logService.error('Error while syncing prompt input model', e);
		}
	}

	private _doSync() {
		if (this._state !== PromptInputState.Input) {
			return;
		}

		let commandStartY = this._commandStartMarker?.line;
		if (commandStartY === undefined) {
			return;
		}

		const buffer = this._xterm.buffer.active;
Repository: microsoft/vscode
File: src/vs/workbench/contrib/browserView/electron-browser/browserViewActions.ts (TypeScript)

Code before:
			keybinding: {
				when: BROWSER_EDITOR_ACTIVE,
				weight: KeybindingWeight.WorkbenchContrib,
				primary: KeyCode.F12
			}
		});
	}

	async run(accessor: ServicesAccessor, browserEditor = accessor.get(IEditorService).activeEditorPane): Promise<void> {
		if (browserEditor instanceof BrowserEditor) {
			await browserEditor.toggleDevTools();
		}
	}
}

class OpenInExternalBrowserAction extends Action2 {
	static readonly ID = 'workbench.action.browser.openExternal';

	constructor() {
		super({
			id: OpenInExternalBrowserAction.ID,
			title: localize2('browser.openExternalAction', 'Open in External Browser'),
			category: BrowserCategory,
			icon: Codicon.linkExternal,
			f1: false,
			menu: {
				id: MenuId.BrowserActionsToolbar,
				group: '2_export',
				order: 1
			}
		});
	}

	async run(accessor: ServicesAccessor, browserEditor = accessor.get(IEditorService).activeEditorPane): Promise<void> {
		if (browserEditor instanceof BrowserEditor) {
			const url = browserEditor.getUrl();
			if (url) {
				const openerService = accessor.get(IOpenerService);
				await openerService.open(url, { openExternal: true });
			}
		}
	}
}

class ClearGlobalBrowserStorageAction extends Action2 {
	static readonly ID = 'workbench.action.browser.clearGlobalStorage';

	constructor() {
		super({
			id: ClearGlobalBrowserStorageAction.ID,
			title: localize2('browser.clearGlobalStorageAction', 'Clear Storage (Global)'),

Review comment (suggestion):
Maybe we should be a bit more explicit? Like so:
```suggestion
			title: localize2('browser.openExternalAction', 'Open Page in External Browser'),
```

Code after:
				id: MenuId.BrowserActionsToolbar,
				group: '1_developer',
				order: 1,
			},
			keybinding: {
				when: BROWSER_EDITOR_ACTIVE,
				weight: KeybindingWeight.WorkbenchContrib,
				primary: KeyCode.F12
			}
		});
	}

	async run(accessor: ServicesAccessor, browserEditor = accessor.get(IEditorService).activeEditorPane): Promise<void> {
		if (browserEditor instanceof BrowserEditor) {
			await browserEditor.toggleDevTools();
		}
	}
}

class OpenInExternalBrowserAction extends Action2 {
	static readonly ID = 'workbench.action.browser.openExternal';

	constructor() {
		super({
			id: OpenInExternalBrowserAction.ID,
			title: localize2('browser.openExternalAction', 'Open in External Browser'),
			category: BrowserCategory,
			icon: Codicon.linkExternal,
			f1: false,
			menu: {
				id: MenuId.BrowserActionsToolbar,
				group: '2_export',
				order: 1
			}
		});
	}

	async run(accessor: ServicesAccessor, browserEditor = accessor.get(IEditorService).activeEditorPane): Promise<void> {
		if (browserEditor instanceof BrowserEditor) {
			const url = browserEditor.getUrl();
			if (url) {
				const openerService = accessor.get(IOpenerService);
				await openerService.open(url, { openExternal: true });
			}
		}
	}
}

class ClearGlobalBrowserStorageAction extends Action2 {
	static readonly ID = 'workbench.action.browser.clearGlobalStorage';
Repository: milvus-io/milvus
File: internal/util/mqclient/pulsar_consumer.go (Go)

Code before:
func (pc *PulsarConsumer) Seek(id MessageID, inclusive bool) error {
	messageID := id.(*pulsarID).messageID
	err := pc.c.Seek(messageID)
	if err == nil {
		pc.hasSeek = true
		// skip the first message when consume
		pc.skip = !inclusive
	}
	return err
}

// Ack the consumption of a single message
func (pc *PulsarConsumer) Ack(message Message) {
	pm := message.(*pulsarMessage)
	pc.c.Ack(pm.msg)
}

// Close the consumer and stop the broker to push more messages
func (pc *PulsarConsumer) Close() {
	pc.c.Close()
	close(pc.closeCh)
}

// patchEarliestMessageID unsafe patch logic to change messageID partitionIdx to 0
// ONLY used in Chan() function
// DON'T use elsewhere
func patchEarliestMessageID(mid *pulsar.MessageID) {
	// cannot use field.SetInt(), since partitionIdx is not exported

	// this reflect+ unsafe solution is disable by go vet

	//ifData := v.InterfaceData() // unwrap interface
	//ifData[1] is the pointer to the exact struct
	// 20 is the offset of paritionIdx of messageID
	//lint:ignore unsafeptr: possible misuse of unsafe.Pointer (govet), hardcoded offset
	//*(*int32)(unsafe.Pointer(v.InterfaceData()[1] + 20)) = 0

	// use direct unsafe conversion
	/* #nosec G103 */
	r := (*iface)(unsafe.Pointer(mid))
	id := (*messageID)(r.Data)
	id.partitionIdx = 0
}

// unsafe access pointer, same as pulsar.messageID
type messageID struct {
	ledgerID     int64
	entryID      int64
	batchID      int32
	partitionIdx int32
}

Review comment (bug):
Should the process panic if the `Unsubscribe` failed? I dont think the failure of `Unsubscribe` is severe like that.

Code after:
// the pointed messageID will be consumed after the seek in pulsar
func (pc *PulsarConsumer) Seek(id MessageID, inclusive bool) error {
	messageID := id.(*pulsarID).messageID
	err := pc.c.Seek(messageID)
	if err == nil {
		pc.hasSeek = true
		// skip the first message when consume
		pc.skip = !inclusive
	}
	return err
}

// Ack the consumption of a single message
func (pc *PulsarConsumer) Ack(message Message) {
	pm := message.(*pulsarMessage)
	pc.c.Ack(pm.msg)
}

// Close the consumer and stop the broker to push more messages
func (pc *PulsarConsumer) Close() {
	pc.closeOnce.Do(func() {
		defer pc.c.Close()
		// Unsubscribe for the consumer
		err := pc.c.Unsubscribe()
		if err != nil {
			panic(err)
		}
		close(pc.closeCh)
	})
}

// patchEarliestMessageID unsafe patch logic to change messageID partitionIdx to 0
// ONLY used in Chan() function
// DON'T use elsewhere
func patchEarliestMessageID(mid *pulsar.MessageID) {
	// cannot use field.SetInt(), since partitionIdx is not exported

	// this reflect+ unsafe solution is disable by go vet

	//ifData := v.InterfaceData() // unwrap interface
	//ifData[1] is the pointer to the exact struct
	// 20 is the offset of paritionIdx of messageID
	//lint:ignore unsafeptr: possible misuse of unsafe.Pointer (govet), hardcoded offset
	//*(*int32)(unsafe.Pointer(v.InterfaceData()[1] + 20)) = 0

	// use direct unsafe conversion
	/* #nosec G103 */
	r := (*iface)(unsafe.Pointer(mid))
	id := (*messageID)(r.Data)
	id.partitionIdx = 0
}
Repository: milvus-io/milvus
File: pkg/util/metricsinfo/quota_metric.go (Go)

Code before:
	ReadyQueue       int64
	ReceiveChan      int64
	ExecuteChan      int64
	AvgQueueDuration time.Duration
}

// NodeEffect contains the a node and its effected collection info.
type NodeEffect struct {
	NodeID        int64
	CollectionIDs []int64
}

// QueryNodeQuotaMetrics are metrics of QueryNode.
type QueryNodeQuotaMetrics struct {
	Hms         HardwareMetrics
	Rms         []RateMetric
	Fgm         FlowGraphMetric
	SearchQueue ReadInfoInQueue
	QueryQueue  ReadInfoInQueue
	Effect      NodeEffect
}

type DataCoordQuotaMetrics struct {
	TotalBinlogSize int64
}

// DataNodeQuotaMetrics are metrics of DataNode.
type DataNodeQuotaMetrics struct {
	Hms    HardwareMetrics
	Rms    []RateMetric
	Fgm    FlowGraphMetric
	Effect NodeEffect
}

// ProxyQuotaMetrics are metrics of Proxy.
type ProxyQuotaMetrics struct {
	Hms HardwareMetrics
	Rms []RateMetric
}


Review comment (bug):
RootCoord upgrade may cause compatability issue here. Since older datacoord does not has `CollectionBinlogsSize` field, the quota limit may be broken here

Code after:
	ReadyQueue       int64
	ReceiveChan      int64
	ExecuteChan      int64
	AvgQueueDuration time.Duration
}

// NodeEffect contains the a node and its effected collection info.
type NodeEffect struct {
	NodeID        int64
	CollectionIDs []int64
}

// QueryNodeQuotaMetrics are metrics of QueryNode.
type QueryNodeQuotaMetrics struct {
	Hms         HardwareMetrics
	Rms         []RateMetric
	Fgm         FlowGraphMetric
	SearchQueue ReadInfoInQueue
	QueryQueue  ReadInfoInQueue
	Effect      NodeEffect
}

type DataCoordQuotaMetrics struct {
	TotalBinlogSize      int64
	CollectionBinlogSize map[int64]int64
}

// DataNodeQuotaMetrics are metrics of DataNode.
type DataNodeQuotaMetrics struct {
	Hms    HardwareMetrics
	Rms    []RateMetric
	Fgm    FlowGraphMetric
	Effect NodeEffect
}

// ProxyQuotaMetrics are metrics of Proxy.
type ProxyQuotaMetrics struct {
	Hms HardwareMetrics
	Rms []RateMetric
}
Repository: milvus-io/milvus
File: internal/storage/minio_object_storage.go (Go)

Code before:
	})

	for object := range in {
		if object.Err != nil {
			return object.Err
		}
		if !walkFunc(&ChunkObjectInfo{FilePath: object.Key, ModifyTime: object.LastModified}) {
			return nil
		}
	}
	return nil
}

// isDeleteSuccessful treats 200 and 404 as successful deletion.
func isDeleteSuccessful(err error) bool {
	if err == nil {
		return true
	}
	statusCode := minio.ToErrorResponse(err).StatusCode
	return statusCode == http.StatusOK || statusCode == http.StatusNotFound
}

func (minioObjectStorage *MinioObjectStorage) RemoveObject(ctx context.Context, bucketName, objectName string) error {
	err := minioObjectStorage.Client.RemoveObject(ctx, bucketName, objectName, minio.RemoveObjectOptions{})
	if isDeleteSuccessful(err) {
		return nil
	}
	return checkObjectStorageError(objectName, err)
}


Review comment (bug):

```if isDeleteSuccessful(err) {
		// If an error exists but is classified as a success (e.g., 200 OK or 404 Not Found),
		// we log it at Debug level to track non-standard S3 responses or idempotent triggers.
		if err != nil {
			log.Debug("object already removed or storage returned non-standard success code", 
				zap.String("object", objectName), 
				zap.Int("status_code", minio.ToErrorResponse(err).StatusCode),
				zap.Error(err))
		}
		return nil
	}
```

Code after:
	})

	for object := range in {
		if object.Err != nil {
			return object.Err
		}
		if !walkFunc(&ChunkObjectInfo{FilePath: object.Key, ModifyTime: object.LastModified}) {
			return nil
		}
	}
	return nil
}

func (minioObjectStorage *MinioObjectStorage) RemoveObject(ctx context.Context, bucketName, objectName string) error {
	// isDeleteSuccessful treats 200 and 404 as successful deletion.
	// Some S3-compatible storage doesn't fully comply with S3 spec (minio SDK expects 204).
	isDeleteSuccessful := func(err error) bool {
		if err == nil {
			return true
		}
		statusCode := minio.ToErrorResponse(err).StatusCode
		return statusCode == http.StatusOK || statusCode == http.StatusNotFound
	}

	err := minioObjectStorage.Client.RemoveObject(ctx, bucketName, objectName, minio.RemoveObjectOptions{})
	if isDeleteSuccessful(err) {
		if err != nil {
			log.Debug("object already removed or storage returned non-standard success code",
				zap.String("bucket", bucketName),
				zap.String("object", objectName),
				zap.Int("statusCode", minio.ToErrorResponse(err).StatusCode))
		}
		return nil
	}
	return checkObjectStorageError(objectName, err)
}
Repository: mitsuhiko/rye
File: rye/src/cli/init.rs (Rust)

Code before:
#[derive(ValueEnum, Copy, Clone, Serialize, Debug)]
#[value(rename_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum BuildSystem {
    Hatchling,
    Setuptools,
    Filt,
}

/// Creates a new python project.
#[derive(Parser, Debug)]
pub struct Args {
    /// Where to place the project (defaults to current path)
    #[arg(default_value = ".")]
    path: PathBuf,
    /// Which interpreter version should be used?
    #[arg(short, long)]
    py: Option<String>,
    /// Do not create a readme.
    #[arg(long)]
    no_readme: bool,
    /// Which build system should be used?
    #[arg(long, default_value = "hatchling")]
    build_system: BuildSystem,
    #[arg(long, default_value = "MIT")]
    license: String,
}

/// The pyproject.toml template
///
/// This uses a template just to simplify the flexibility of emitting it.
const TOML_TEMPLATE: &str = r#"[project]
name = {{ name }}
version = {{ version }}
description = "Add a short description here"
{%- if author %}
authors = [
    { name = {{ author[0] }}, email = {{ author[1] }} }
]
{%- endif %}
dependencies = []
{%- if with_readme %}
readme = "README.md"
{%- endif %}
requires-python = {{ requires_python }}
license = { text = {{ license }} }

[build-system]
{%- if build_system == "hatchling" %}
requires = ["hatchling"]
build-backend = "hatchling.build"

Review comment (suggestion):
I think the license choice should be opt-in. Let's make this `Option<String>` instead and only create the license if it's passed explicitly.

Code after:
#[value(rename_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum BuildSystem {
    Hatchling,
    Setuptools,
    Filt,
}

/// Creates a new python project.
#[derive(Parser, Debug)]
pub struct Args {
    /// Where to place the project (defaults to current path)
    #[arg(default_value = ".")]
    path: PathBuf,
    /// Which interpreter version should be used?
    #[arg(short, long)]
    py: Option<String>,
    /// Do not create a readme.
    #[arg(long)]
    no_readme: bool,
    /// Which build system should be used?
    #[arg(long, default_value = "hatchling")]
    build_system: BuildSystem,
    #[arg(long)]
    license: Option<String>,
}

/// The pyproject.toml template
///
/// This uses a template just to simplify the flexibility of emitting it.
const TOML_TEMPLATE: &str = r#"[project]
name = {{ name }}
version = {{ version }}
description = "Add a short description here"
{%- if author %}
authors = [
    { name = {{ author[0] }}, email = {{ author[1] }} }
]
{%- endif %}
dependencies = []
{%- if with_readme %}
readme = "README.md"
{%- endif %}
requires-python = {{ requires_python }}
{%- if license %}
license = { text = {{ license }} }
{%- endif %}

[build-system]
{%- if build_system == "hatchling" %}
requires = ["hatchling"]
Repository: mitsuhiko/rye
File: rye/src/cli/version.rs (Rust)

Code before:
            let mut version = pyproject_toml.version()?;
            match cmd.bump {
                Some(bump) => bump_version(&mut version, &bump, &mut pyproject_toml),
                None => eprintln!("{}", version),
            }
        }
    }
    Ok(())
}

fn bump_version(version: &mut Version, bump: &str, pyproject: &mut PyProject) {
    if version.is_post() {
        version.post = None;
    }
    if version.is_dev() {
        version.dev = None;
        eprintln!(
            "{} dev version will be bumped to release version",
            style("warning:").red()
        );
    } else {
        match bump {
            "major" => version.release[0] += 1,
            "minor" => version.release[1] += 1,
            "patch" => version.release[2] += 1,
            _ => return,
        }
    }

    pyproject.set_version(version);
    pyproject.save().unwrap();

    eprintln!("version bumped to {}", version);
}


Review comment (bug):
It would be good to give an error here on invalid input. Right now i think you could use an enum and then clap would handle it.

Code after:
                Version::from_str(&version).map_err(|msg| anyhow!("invalid version: {}", msg))?;
            pyproject_toml.set_version(&version);
            pyproject_toml.save()?;

            eprintln!("version set to {}", version);
        }
        None => {
            let mut version = pyproject_toml.version()?;
            match cmd.bump {
                Some(bump) => bump_version(&mut version, bump, &mut pyproject_toml)?,
                None => eprintln!("{}", version),
            }
        }
    }
    Ok(())
}

fn bump_version(version: &mut Version, bump: Bump, pyproject: &mut PyProject) -> Result<(), Error> {
    if version.is_post() {
        version.post = None;
    }
    if version.is_dev() {
        version.dev = None;
        eprintln!(
            "{} dev version will be bumped to release version",
            style("warning:").red()
        );
    } else {
        let index = bump as usize;
        if version.release.get(index).is_none() {
            version.release.resize(index + 1, 0);
        }
        version.release[index] += 1;
    }

    pyproject.set_version(version);
    pyproject.save().unwrap();

    eprintln!("version bumped to {}", version);

    Ok(())
}
Repository: mitsuhiko/rye
File: rye/src/cli/version.rs (Rust)

Code before:

            eprintln!("version set to {}", version);
        }
        None => {
            let mut version = pyproject_toml.version()?;
            match cmd.bump {
                Some(bump) => bump_version(&mut version, bump, &mut pyproject_toml)?,
                None => eprintln!("{}", version),
            }
        }
    }
    Ok(())
}

fn bump_version(version: &mut Version, bump: Bump, pyproject: &mut PyProject) -> Result<(), Error> {
    if version.is_post() {
        version.post = None;
    }
    if version.is_dev() {
        version.dev = None;
        eprintln!(
            "{} dev version will be bumped to release version",
            style("warning:").red()
        );
    } else {
        version.release[bump as usize] += 1;
    }

    pyproject.set_version(version);
    pyproject.save().unwrap();

    eprintln!("version bumped to {}", version);

    Ok(())
}


Review comment (suggestion):
I just realized that you can have a version `1.0` which results in `release` being `[1, 0]`. This would on a minor bump cause a panic here. I think it would need to initialize missing values to `0`.

Code after:

            eprintln!("version set to {}", version);
        }
        None => {
            let mut version = pyproject_toml.version()?;
            match cmd.bump {
                Some(bump) => bump_version(&mut version, bump, &mut pyproject_toml)?,
                None => eprintln!("{}", version),
            }
        }
    }
    Ok(())
}

fn bump_version(version: &mut Version, bump: Bump, pyproject: &mut PyProject) -> Result<(), Error> {
    if version.is_post() {
        version.post = None;
    }
    if version.is_dev() {
        version.dev = None;
        eprintln!(
            "{} dev version will be bumped to release version",
            style("warning:").red()
        );
    } else {
        let index = bump as usize;
        if version.release.get(index).is_none() {
            version.release.resize(index + 1, 0);
        }
        version.release[index] += 1;
    }

    pyproject.set_version(version);
    pyproject.save().unwrap();

    eprintln!("version bumped to {}", version);

    Ok(())
}
Repository: moby/moby
File: vendor/src/github.com/docker/libcontainer/nsinit/pause.go (Go)

Code before:
package main

import (
	"log"

	"github.com/codegangsta/cli"
	"github.com/docker/libcontainer/cgroups"
	"github.com/docker/libcontainer/cgroups/fs"
	"github.com/docker/libcontainer/cgroups/systemd"
)

var pauseCommand = cli.Command{
	Name:   "pause",
	Usage:  "pause the container's processes",
	Action: pauseAction,
}

var unpauseCommand = cli.Command{
	Name:   "unpause",
	Usage:  "unpause the container's processes",
	Action: unpauseAction,
}

func pauseAction(context *cli.Context) {
	if err := toggle(cgroups.Frozen); err != nil {
		log.Fatal(err)
	}
}

func unpauseAction(context *cli.Context) {
	if err := toggle(cgroups.Thawed); err != nil {
		log.Fatal(err)
	}
}

func toggle(state cgroups.FreezerState) error {
	container, err := loadConfig()
	if err != nil {
		return err
	}

	if container.Cgroups.Driver == "systemd" && systemd.UseSystemd() {
		err = systemd.Freeze(container.Cgroups, state)
	} else {
		err = fs.Freeze(container.Cgroups, state)
	}

	return err
}


Review comment (suggestion):
If you look at the patch in libcontainer that's linked from this PR you
will see the circular dependency problem

On Wednesday, January 28, 2015, Kevin Ran notifications@github.com wrote:

> In vendor/src/github.com/docker/libcontainer/nsinit/pause.go
> https://github.com/docker/docker/pull/10427#discussion_r23744403:
> 
> > @@ -39,7 +39,7 @@ func toggle(state cgroups.FreezerState) error {
> >         return err
> >     }
> > -   if systemd.UseSystemd() {
> > -   if container.Cgroups.Driver == "systemd" && systemd.UseSystemd() {
> 
> much container.Cgroups.Driver == "systemd". Is there a reason why it
> shouldn't just be container.Cgroups.IsSystemd()?
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/docker/docker/pull/10427/files#r23744403.


Code after:
package main

import (
	"log"

	"github.com/codegangsta/cli"
)

var pauseCommand = cli.Command{
	Name:  "pause",
	Usage: "pause the container's processes",
	Flags: []cli.Flag{
		cli.StringFlag{Name: "id", Value: "nsinit", Usage: "specify the ID for a container"},
	},
	Action: func(context *cli.Context) {
		container, err := getContainer(context)
		if err != nil {
			log.Fatal(err)
		}
		if err = container.Pause(); err != nil {
			log.Fatal(err)
		}
	},
}

var unpauseCommand = cli.Command{
	Name:  "unpause",
	Usage: "unpause the container's processes",
	Flags: []cli.Flag{
		cli.StringFlag{Name: "id", Value: "nsinit", Usage: "specify the ID for a container"},
	},
	Action: func(context *cli.Context) {
		container, err := getContainer(context)
		if err != nil {
			log.Fatal(err)
		}
		if err = container.Resume(); err != nil {
			log.Fatal(err)
		}
	},
}